<?php

namespace Sifast\ProjectBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class PermisAdmin extends Admin
{
 
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
        ->with('L1')
            ->add('typePermis','text',array(
                'label'=>'Type de permis:'
            ))
            ->add('dateObtention', 'date', array(
                    'label'=> "Date d'obtention:",
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
        ->end()
        ->with('L2')        
            ->add('dateExpiration', 'date', array(
                    'label'=> "Date d'expiration:",
                    'widget' => 'single_text',
                    'format' => 'MM/dd/yyyy',
                    'attr' => array('class' => 'datepicker')
                ))
            ->add('numPermis','text',array(
                'label'=>'Numéro de permis:'
            ))   
            ->end();
            
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('typePermis')
            ->add('dateObtentation')
            ->add('dateExpiration');
            
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('typePermis')
            ->add('dateObtentation')
            ->add('dateExpiration');
            
            }
}